<?php
/**
 * Dao of Promotion
 *
 * @author fsqijy
 */
require_once BaseUtil::getModulePath("base") . '/models/BaseDao.php';

class PromotionActionDao extends BaseDao {

    protected $_name;

    protected $promotionConditions;
    public function  _setup() {
        $this->_name = $this->prefix() . "promotion_actions";
        $this->promotionConditions = $this->prefix() . "promotion_conditions";
        parent::_setup();
    }
    public function getActionBypromotionid($promotionid) {
        $select = $this->db_r->select();
        $select->from($this->_name,"*");
        $select->where('promotion_id = ?', $promotionid);
        $select->where('is_delete = 0');
        $sql = $select->__toString();
        $result = $this->db_r->fetchAll($sql);
        return $result;
    }
    public function delAction($promotionid) {
        $where = $this->db_w->quoteInto('promotion_id = ?', $promotionid);
        $this->delete($where);
    }
    public function deleteAction($promotionid) {
        $data = array('is_delete' => 1);
        $where = $this->db_w->quoteInto('promotion_id = ? ', $promotionid);
        $this->updateData($data, $where);
    }

}
